package com.example.epic.controller;

import com.example.epic.bean.Application;
import com.example.epic.bean.InAndOutRecord;
import com.example.epic.bean.mq.RocketMQSender;
import com.example.epic.common.ResponseData;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private RocketMQSender rocketMQSender;

    @GetMapping(value = "/mq")
    @ResponseBody
    public ResponseData mq(){
        System.out.println("mq");
        rocketMQSender.send();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return ResponseData.success("成功");
    }


    // 测试
    @GetMapping(value = "/inOut")
    @ResponseBody
    public ResponseData saveInOutRecord(){
        InAndOutRecord lxh = new InAndOutRecord("openid...", "201620010027", "lxh", new Date());
        return ResponseData.success("提交出入记录成功");
    }
}
